package fr.inserm.u915.tabixserver;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

public class XSD
	{
	public static final String NS="http://www.w3.org/2001/XMLSchema";
	public static final String prefix="xsd";
	static void defineAttribute(XMLStreamWriter w,String name,String type) throws XMLStreamException
		{
		w.writeStartElement(prefix, "attribute", NS);
		w.writeAttribute("name", name);
		w.writeAttribute("type", type);
		w.writeEndElement();
		}
	
	static void writeAnnotation(XMLStreamWriter w,String doc) throws XMLStreamException
		{
		if(doc==null || doc.isEmpty()) return;
		w.writeStartElement(prefix, "annotation", NS);
		w.writeStartElement(prefix, "documentation", NS);
		w.writeCharacters(doc);
		w.writeEndElement();
		w.writeEndElement();
		}
	}
